/*
 * Copyright (c) 2018 Hitevision
 */

package tw.com.hitevision.whiteboard.android.display;

import android.content.Context;

import androidx.annotation.ColorInt;

public interface DisplayManager {

    class DisplayManagerHolder {
        private static final DisplayManager instance = new DisplayManagerImpl();
    }

    static DisplayManager getInstance() {
        return DisplayManagerHolder.instance;
    }

    /**
     * Checks system settings and returns {@code true} if writing eye protection mode is enabled.
     */
    boolean isWritingEyeProtectionEnabled(Context context);

    /**
     * Checks system settings and returns {@code true} if blue light filter mode is enabled.
     */
    boolean isBluelightFilterEnabled(Context context);

    /**
     * Returns the current blue light filter value.
     */
    int getBluelightFilterValue(Context context);

    /**
     * Returns a color after passing it through the blue light filter.
     */
    @ColorInt
    int getBluelightFilteredColor(Context context, @ColorInt int color);

    /**
     * Sets the display backlight.
     */
    void setBacklight(Context context, int value);

    /**
     * This method is required as a workaround for TvPictureManager not updating the backlight
     * value correctly.
     */
    void saveBacklightToSettings(Context context, int value);

    /**
     * Returns the current backlight value.
     *
     * @return the backlight value, {@code 0} if unsupported
     */
    int getBacklight(Context context);
}
